# bar.py

import operator

from ot_simulator.tk_gui.input_fields import *
from ot_simulator.tk_gui.method_interfaces import *
from ot_simulator.tk_gui.test.accessors import *
from ot_simulator.tk_gui.test.base import base
from ot_simulator.tk_gui.test.foo import foo

class bar(base):
    input_fields = (
        list_field('bar1', attr_accessor('bar1'), obj_list_manager.using(foo)),
        output_filename('bar2', attr_accessor('bar2'),
                        (("blah file", '.blah'),)),
      )
    methods = (
        method_without_parameters('bar_fn1', operator.methodcaller('bar_fn1')),
        method_with_parameters('bar_fn2', methodcaller('bar_fn2'),
          text_field('x'),
          output_filename('y', filetypes=(('fn2 file', '.fn2'),)),
        ),
      ) + base.methods

    def bar_fn1(self):
        print "bar_fn1:", "bar1", self.bar1, "bar2", self.bar2

    def bar_fn2(self, x, y):
        print "bar_fn2:", "x", x, "y", y
        print "bar_fn2:", "bar1", self.bar1, "bar2", self.bar2
